<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<title>交易接口Python文档.md</title><link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext' rel='stylesheet' type='text/css'><style type='text/css'>html, body {overflow-x: initial !important;}.CodeMirror { height: auto; }
.CodeMirror-scroll { overflow-y: hidden; overflow-x: auto; }
.CodeMirror-lines { padding: 4px 0px; }
.CodeMirror pre { }
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { background-color: white; }
.CodeMirror-gutters { border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); white-space: nowrap; background-color: rgb(247, 247, 247); }
.CodeMirror-linenumbers { }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153); }
.CodeMirror div.CodeMirror-cursor { border-left-width: 1px; border-left-style: solid; border-left-color: black; z-index: 3; }
.CodeMirror div.CodeMirror-secondarycursor { border-left-width: 1px; border-left-style: solid; border-left-color: silver; }
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor { width: auto; border: 0px; z-index: 1; background: rgb(119, 238, 119); }
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite { }
.cm-tab { display: inline-block; }
.cm-s-typora-default .cm-header, .cm-s-typora-default .cm-property { color: rgb(217, 79, 138); }
.cm-s-typora-default pre.cm-header1:not(.cm-atom) :not(.cm-overlay) { font-size: 2rem; line-height: 2rem; }
.cm-s-typora-default pre.cm-header2:not(.cm-atom) :not(.cm-overlay) { font-size: 1.4rem; line-height: 1.4rem; }
.cm-s-typora-default .cm-atom, .cm-s-typora-default .cm-number { color: rgb(149, 132, 134); }
.cm-s-typora-default .cm-table-row, .cm-s-typora-default .cm-block-start { font-family: monospace; }
.cm-s-typora-default .cm-comment { color: rgb(74, 90, 159); font-family: monospace; }
.cm-s-typora-default .cm-tag { color: rgb(169, 68, 66); }
.cm-s-typora-default .cm-string { color: rgb(126, 134, 169); }
.cm-s-typora-default .cm-link { color: rgb(196, 122, 15); text-decoration: underline; }
.cm-s-typora-default .cm-variable-2, .cm-s-typora-default .cm-variable-1 { color: inherit; }
.cm-s-typora-default .cm-overlay { font-size: 1rem; font-family: monospace; }
.CodeMirror.cm-s-typora-default div.CodeMirror-cursor { border-left-width: 3px; border-left-style: solid; border-left-color: rgb(228, 98, 154); }
.cm-s-typora-default .CodeMirror-activeline-background { left: -60px; right: -30px; background: rgba(204, 204, 204, 0.2); }
.cm-s-typora-default .CodeMirror-gutters { border-right-style: none; background-color: inherit; }
.cm-s-typora-default .cm-trailing-space-new-line::after, .cm-startspace::after, .cm-starttab .cm-tab::after { content: "•"; position: absolute; left: 0px; opacity: 0; font-family: LetterGothicStd, monospace; }
.os-windows .cm-startspace::after, .os-windows .cm-starttab .cm-tab::after { left: -0.1em; }
.cm-starttab .cm-tab::after { content: " "; }
.cm-startspace, .cm-tab, .cm-starttab, .cm-trailing-space-a, .cm-trailing-space-b, .cm-trailing-space-new-line { font-family: monospace; position: relative; }
.cm-s-typora-default .cm-trailing-space-new-line::after { content: "↓"; opacity: 0.3; }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(34, 17, 153); }
.cm-s-inner .cm-number { color: rgb(17, 102, 68); }
.cm-s-inner .cm-def { color: rgb(0, 0, 255); }
.cm-s-inner .cm-variable { color: black; }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170); }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85); }
.cm-s-inner .cm-property { color: black; }
.cm-s-inner .cm-operator { color: black; }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(170, 85, 0); }
.cm-s-inner .cm-string { color: rgb(170, 17, 17); }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0); }
.cm-s-inner .cm-meta { color: rgb(85, 85, 85); }
.cm-s-inner .cm-qualifier { color: rgb(85, 85, 85); }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170); }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119); }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0); }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204); }
.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: blue; }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(0, 153, 0); }
.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgb(153, 153, 153); }
.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgb(0, 0, 204); }
.cm-negative { color: rgb(221, 68, 68); }
.cm-positive { color: rgb(34, 153, 34); }
.cm-header, .cm-strong { font-weight: bold; }
.cm-del { text-decoration: line-through; }
.cm-em { font-style: italic; }
.cm-link { text-decoration: underline; }
.cm-error { color: rgb(255, 0, 0); }
.cm-invalidchar { color: rgb(255, 0, 0); }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0); }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34); }
.CodeMirror-activeline-background { background: rgb(232, 242, 255); }
.CodeMirror { position: relative; overflow: hidden; }
.CodeMirror-scroll { margin-bottom: -30px; margin-right: -30px; padding-bottom: 30px; padding-right: 30px; height: 100%; outline: none; position: relative; box-sizing: content-box; }
.CodeMirror-sizer { position: relative; }
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { position: absolute; z-index: 6; display: none; }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow-x: hidden; overflow-y: scroll; }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow-y: hidden; overflow-x: scroll; }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px; }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px; }
.CodeMirror-gutters { position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3; }
.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block; }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4; }
.CodeMirror-lines { cursor: text; }
.CodeMirror pre { border-radius: 0px; border-width: 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; word-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible; background: transparent; }
.CodeMirror-wrap pre { word-wrap: break-word; white-space: pre-wrap; word-break: normal; }
.CodeMirror-code pre { border-right-width: 30px; border-right-style: solid; border-right-color: transparent; width: fit-content; }
.CodeMirror-wrap .CodeMirror-code pre { border-right-style: none; width: auto; }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0; }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto; }
.CodeMirror-widget { }
.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden; }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden; }
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right-style: none; width: 0px; }
.CodeMirror div.CodeMirror-cursor { visibility: hidden; }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit; }
.CodeMirror-selected { background: rgb(217, 217, 217); }
.CodeMirror-focused .CodeMirror-selected { background: rgb(215, 212, 240); }
.cm-searching { background: rgba(255, 255, 0, 0.4); }
.CodeMirror span { }
@media print { 
  .CodeMirror div.CodeMirror-cursor { visibility: hidden; }
}


html { font-size: 14px; }
body { margin: 0px; padding: 0px; height: auto; bottom: 0px; top: 0px; left: 0px; right: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 1rem; line-height: 1.42857; color: rgb(51, 51, 51); overflow-x: hidden; background-color: rgb(255, 255, 255); }
a:active, a:hover { outline: 0px; }
.in-text-selection, ::selection { text-shadow: none; background: rgb(181, 214, 252); }
#write { margin: 0px auto; height: auto; width: inherit; word-break: normal; word-wrap: break-word; position: relative; padding-bottom: 70px; white-space: pre-wrap; }
body.typora-export { padding-left: 30px; padding-right: 30px; }
.typora-export #write { margin: 0px auto; }
#write > p:first-child, #write > ul:first-child, #write > ol:first-child, #write > pre:first-child, #write > blockquote:first-child, #write > div:first-child, #write > table:first-child { margin-top: 30px; }
img { max-width: 100%; }
input, button, select, textarea { color: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
::before, ::after, * { box-sizing: border-box; }
#write p, #write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write div, #write pre { width: inherit; }
#write p, #write h1, #write h2, #write h3, #write h4, #write h5, #write h6 { position: relative; }
h1 { font-size: 2rem; }
p { -webkit-margin-before: 1rem; -webkit-margin-after: 1rem; -webkit-margin-start: 0px; -webkit-margin-end: 0px; }
.mathjax-block { margin-top: 0px; margin-bottom: 0px; -webkit-margin-before: 0rem; -webkit-margin-after: 0rem; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: bold; font-style: italic; }
a { cursor: pointer; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; margin: 4px 0px 0px; }
tr { page-break-inside: avoid; page-break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; page-break-inside: auto; }
table.md-table td { min-width: 80px; }
.CodeMirror-gutters { border-right-width: 0px; background-color: inherit; }
.CodeMirror { text-align: left; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
pre { white-space: pre-wrap; }
.CodeMirror-gutters { margin-right: 4px; }
.md-fences, pre.md-fences { font-size: 0.9rem; display: block; page-break-inside: avoid; text-align: left; overflow: visible; white-space: pre; position: relative !important; background: inherit; }
.md-fences .CodeMirror.CodeMirror-wrap { top: -1.6em; margin-bottom: -1.6em; }
.md-fences.mock-cm { white-space: pre-wrap; }
.show-fences-line-number pre.md-fences { padding-left: 0px; }
.show-fences-line-number pre.md-fences.mock-cm { padding-left: 40px; }
.footnotes { color: rgb(136, 136, 136); font-size: 0.9rem; padding-top: 1em; padding-bottom: 1em; }
.footnotes + .footnotes { margin-top: -1em; }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; text-decoration: none; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 1rem; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: normal; text-align: left; box-sizing: content-box; direction: ltr; background: transparent; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li p, li .mathjax-block { margin: 0.5rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; }
@media print { 
  html, body { height: 100%; }
  .typora-export * { -webkit-print-color-adjust: exact; }
  h1, h2, h3, h4, h5, h6 { page-break-after: avoid; orphans: 2; }
  p { orphans: 4; }
  @page { margin: 20mm 0mm; }
}
.footnote-line { margin-top: 0.714em; font-size: 0.7em; }
a img, img a { cursor: pointer; }
#write pre.md-meta-block { font-size: 0.8rem; min-height: 2.86rem; white-space: pre-wrap; display: block; background: rgb(204, 204, 204); }
p > .md-image:only-child { display: inline-block; width: 100%; text-align: center; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.mathjax-block { white-space: pre; overflow: hidden; width: 100%; }
p + .mathjax-block { margin-top: -1.143rem; }
.mathjax-block:not(:empty)::after { display: none; }
[contenteditable="true"]:active, [contenteditable="true"]:focus { outline: none; box-shadow: none; }
.task-list { list-style-type: none; }
.task-list-item { position: relative; padding-left: 1em; }
.task-list-item input { position: absolute; top: 0px; left: 0px; }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc::after, .md-toc-content::after { display: none; }
.md-toc-item { display: block; color: rgb(65, 131, 196); text-decoration: none; }
.md-toc-inner:hover { text-decoration: underline; }
.md-toc-inner { display: inline-block; cursor: pointer; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: bold; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
.md-toc-h6 { margin-left: 12em; }
@media screen and (max-width: 48em) { 
  .md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
  .md-toc-h4 .md-toc-inner { margin-left: 5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 8em; }
  .md-toc-h6 { margin-left: 9.5em; }
}
a.md-toc-inner { color: inherit; font-size: inherit; font-style: inherit; font-weight: inherit; text-decoration: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
.md-tag { opacity: 0.5; }
code { text-align: left; }
h1 .md-tag, h2 .md-tag, h3 .md-tag, h4 .md-tag, h5 .md-tag, h6 .md-tag { font-weight: initial; opacity: 0.35; }
a.md-header-anchor.md-print-anchor { border: none !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: none !important; text-decoration: initial !important; text-shadow: initial !important; background: transparent !important; }
.md-inline-math .MathJax_SVG .noError { display: none !important; }
.mathjax-block .MathJax_SVG_Display { text-align: center; margin: 1em 0em; position: relative; text-indent: 0px; max-width: none; max-height: none; min-width: 0px; min-height: 0px; width: 100%; display: block !important; }
.MathJax_SVG_Display, .md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important; }
.MathJax_SVG .MJX-monospace { font-family: monospace; }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif; }
.MathJax_SVG { display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin: 0px; }
.MathJax_SVG * { transition: none; }


@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: normal; src: local(Open Sans Regular), url(file:///C:/Users/Administrator/AppData/Roaming/Typora/themes/github/400.woff) format(woff); }
@font-face { font-family: 'Open Sans'; font-style: italic; font-weight: normal; src: local(Open Sans Italic), url(file:///C:/Users/Administrator/AppData/Roaming/Typora/themes/github/400i.woff) format(woff); }
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: bold; src: local(Open Sans Bold), url(file:///C:/Users/Administrator/AppData/Roaming/Typora/themes/github/700.woff) format(woff); }
@font-face { font-family: 'Open Sans'; font-style: italic; font-weight: bold; src: local(Open Sans Bold Italic), url(file:///C:/Users/Administrator/AppData/Roaming/Typora/themes/github/700i.woff) format(woff); }
html { font-size: 16px; }
body { font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; color: rgb(51, 51, 51); line-height: 1.6; -webkit-font-smoothing: antialiased; }
#write { max-width: 800px; margin: 0px auto; padding: 20px 30px 40px; }
#write::after { height: 80px; }
#write > ul:first-child, #write > ol:first-child { margin-top: 30px; }
body > :first-child { margin-top: 0px !important; }
body > :last-child { margin-bottom: 0px !important; }
a { color: rgb(65, 131, 196); }
h1, h2, h3, h4, h5, h6 { position: relative; margin-top: 1rem; margin-bottom: 1rem; font-weight: bold; line-height: 1.4; -webkit-font-smoothing: antialiased; cursor: text; }
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor { text-decoration: none; }
h1 tt, h1 code { font-size: inherit; }
h2 tt, h2 code { font-size: inherit; }
h3 tt, h3 code { font-size: inherit; }
h4 tt, h4 code { font-size: inherit; }
h5 tt, h5 code { font-size: inherit; }
h6 tt, h6 code { font-size: inherit; }
h1 { padding-bottom: 0.3em; font-size: 2.25em; line-height: 1.2; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); }
h2 { padding-bottom: 0.3em; font-size: 1.75em; line-height: 1.225; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); }
h3 { font-size: 1.5em; line-height: 1.43; }
h4 { font-size: 1.25em; }
h5 { font-size: 1em; }
h6 { font-size: 1em; color: rgb(119, 119, 119); }
p, blockquote, ul, ol, dl, table { margin: 0.8em 0px; }
li > ol, li > ul { margin: 0px; }
hr { height: 4px; padding: 0px; margin: 16px 0px; border-width: 0px 0px 1px; border-style: none none solid; overflow: hidden; box-sizing: content-box; border-bottom-color: rgb(221, 221, 221); background-color: rgb(231, 231, 231); }
body > h2:first-child { margin-top: 0px; padding-top: 0px; }
body > h1:first-child { margin-top: 0px; padding-top: 0px; }
body > h1:first-child + h2 { margin-top: 0px; padding-top: 0px; }
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child { margin-top: 0px; padding-top: 0px; }
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 { margin-top: 0px; padding-top: 0px; }
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p { margin-top: 0px; }
li p.first { display: inline-block; }
ul, ol { padding-left: 30px; }
ul:first-child, ol:first-child { margin-top: 0px; }
ul:last-child, ol:last-child { margin-bottom: 0px; }
blockquote { border-left-width: 4px; border-left-style: solid; border-left-color: rgb(221, 221, 221); padding: 0px 15px; color: rgb(119, 119, 119); }
blockquote blockquote { padding-right: 0px; }
table { padding: 0px; }
table tr { border-top-width: 1px; border-top-style: solid; border-top-color: rgb(204, 204, 204); margin: 0px; padding: 0px; background-color: white; }
table tr:nth-child(2n) { background-color: rgb(248, 248, 248); }
table tr th { font-weight: bold; border: 1px solid rgb(204, 204, 204); text-align: left; margin: 0px; padding: 6px 13px; }
table tr td { border: 1px solid rgb(204, 204, 204); text-align: left; margin: 0px; padding: 6px 13px; }
table tr th:first-child, table tr td:first-child { margin-top: 0px; }
table tr th:last-child, table tr td:last-child { margin-bottom: 0px; }
.CodeMirror-gutters { border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); }
pre.md-fences, .md-fences, code, tt { border: 1px solid rgb(221, 221, 221); border-radius: 3px; font-family: Consolas, 'Liberation Mono', Courier, monospace; padding: 2px 4px 0px; font-size: 0.9em; background-color: rgb(248, 248, 248); }
pre.md-fences, .md-fences { margin-bottom: 15px; margin-top: 15px; padding: 8px 1em 6px; }
.task-list { padding-left: 0px; }
.task-list-item { padding-left: 32px; }
.task-list-item input { top: 3px; left: 8px; }
@media screen and (min-width: 914px) { 
}
@media print { 
  table, pre { page-break-inside: avoid; }
  pre { word-wrap: break-word; }
}
.md-fences { background-color: rgb(248, 248, 248); }
#write pre.md-meta-block { padding: 1rem; font-size: 85%; line-height: 1.45; border: 0px; border-radius: 3px; color: rgb(119, 119, 119); margin-top: 0px !important; background-color: rgb(247, 247, 247); }
.mathjax-block > .code-tooltip { bottom: 0.375rem; }
#write > h3.md-focus::before { left: -1.5625rem; top: 0.375rem; }
#write > h4.md-focus::before { left: -1.5625rem; top: 0.285714rem; }
#write > h5.md-focus::before { left: -1.5625rem; top: 0.285714rem; }
#write > h6.md-focus::before { left: -1.5625rem; top: 0.285714rem; }
.md-image > .md-meta { border: 1px solid rgb(221, 221, 221); border-radius: 3px; font-family: Consolas, 'Liberation Mono', Courier, monospace; padding: 2px 4px 0px; font-size: 0.9em; color: inherit; background-color: rgb(248, 248, 248); }
.md-tag { color: inherit; }
.md-toc { margin-top: 20px; padding-bottom: 20px; }
#typora-quick-open { border: 1px solid rgb(221, 221, 221); background-color: rgb(248, 248, 248); }
#typora-quick-open-item { border-color: rgb(254, 254, 254) rgb(229, 229, 229) rgb(229, 229, 229) rgb(238, 238, 238); border-style: solid; border-width: 1px; background-color: rgb(250, 250, 250); }


</style>
</head>
<body class='typora-export' >
<div  id='write'  class = 'is-node'><div class='md-toc' mdtype='toc'><p class="md-toc-content"><span class="md-toc-item md-toc-h1" data-ref="c6"><a class="md-toc-inner" href="#header-c6">港股交易接口</a></span><span class="md-toc-item md-toc-h3" data-ref="c7"><a class="md-toc-inner" href="#header-c7">实例化上下文对象</a></span><span class="md-toc-item md-toc-h3" data-ref="c16"><a class="md-toc-inner" href="#header-c16">解锁接口 unlock_trade</a></span><span class="md-toc-item md-toc-h3" data-ref="c38"><a class="md-toc-inner" href="#header-c38">下单接口 place_order</a></span><span class="md-toc-item md-toc-h3" data-ref="c111"><a class="md-toc-inner" href="#header-c111">设置订单状态 set_order_status</a></span><span class="md-toc-item md-toc-h3" data-ref="c173"><a class="md-toc-inner" href="#header-c173">修改订单 change_order</a></span><span class="md-toc-item md-toc-h3" data-ref="c221"><a class="md-toc-inner" href="#header-c221">查询账户信息 accinfo_query</a></span><span class="md-toc-item md-toc-h3" data-ref="c287"><a class="md-toc-inner" href="#header-c287">查询订单列表 order_list_query</a></span><span class="md-toc-item md-toc-h3" data-ref="c399"><a class="md-toc-inner" href="#header-c399">查询持仓列表 position_list_query</a></span><span class="md-toc-item md-toc-h3" data-ref="c485"><a class="md-toc-inner" href="#header-c485">查询成交列表 deal_list_query</a></span><span class="md-toc-item md-toc-h1" data-ref="c572"><a class="md-toc-inner" href="#header-c572">美股交易接口</a></span><span class="md-toc-item md-toc-h3" data-ref="c573"><a class="md-toc-inner" href="#header-c573">实例化上下文对象</a></span><span class="md-toc-item md-toc-h3" data-ref="c582"><a class="md-toc-inner" href="#header-c582">解锁接口 unlock_trade</a></span><span class="md-toc-item md-toc-h3" data-ref="c604"><a class="md-toc-inner" href="#header-c604">下单接口 place_order</a></span><span class="md-toc-item md-toc-h3" data-ref="c668"><a class="md-toc-inner" href="#header-c668">设置订单状态 set_order_status</a></span><span class="md-toc-item md-toc-h3" data-ref="c702"><a class="md-toc-inner" href="#header-c702">修改订单 change_order</a></span><span class="md-toc-item md-toc-h3" data-ref="c738"><a class="md-toc-inner" href="#header-c738">查询账户信息 accinfo_query</a></span><span class="md-toc-item md-toc-h3" data-ref="c792"><a class="md-toc-inner" href="#header-c792">查询订单列表 order_list_query</a></span><span class="md-toc-item md-toc-h3" data-ref="c892"><a class="md-toc-inner" href="#header-c892">查询持仓列表 position_list_query</a></span><span class="md-toc-item md-toc-h3" data-ref="c966"><a class="md-toc-inner" href="#header-c966">查询成交列表 deal_list_query</a></span></p></div><h1><a name='header-c6' class='md-header-anchor '></a>港股交易接口</h1><h3><a name='header-c7' class='md-header-anchor '></a>实例化上下文对象</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure">AخA</div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">tradehk_ctx</span> = <span class="cm-variable">OpenHKTradeContext</span>(<span class="cm-variable">host</span>=<span class="cm-string">'127.0.0.1'</span>, <span class="cm-variable">sync_port</span>=<span class="cm-number">11111</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：创建上下文，建立网络连接
<strong>参数</strong>:
<strong>host</strong>：网络连接地址。
<strong>sync_port</strong>：网络连接端口，用于同步通信。</p><p></p><h3><a name='header-c16' class='md-header-anchor '></a>解锁接口 unlock_trade</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">unlock_trade</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">password</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：港股交易解锁。</p><p><strong>参数</strong>：
<strong>cookie</strong>: 本地cookie，用来区分回包。
<strong>password</strong>: 用户交易密码。</p><p><strong>返回</strong>：
ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>失败情况</strong>：</p><ol><li>交易密码错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c38' class='md-header-anchor '></a>下单接口 place_order</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">place_order</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">price</span>, <span class="cm-variable">qty</span>, <span class="cm-variable">strcode</span>, <span class="cm-variable">orderside</span>, <span class="cm-variable">ordertype</span>=<span class="cm-number">0</span>, <span class="cm-variable">envtype</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：港股下单接口。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包。</p><p><strong>price</strong>: 交易价格。</p><p><strong>qty</strong>: 交易数量。</p><p><strong>strcode</strong>: 股票ID。<strong>不用带市场参数</strong>。例如：“00700”。</p><p><strong>orderside</strong>: 交易方向。如下表所示。</p><p><strong>ordertype</strong>: 交易类型。<strong>与美股不同！</strong>如下表所示。</p><p><strong>envtype</strong>: 交易环境参数。如下表所示。</p><table><thead><tr><th>orderside</th><th>交易方向</th></tr></thead><tbody><tr><td>0</td><td>买入</td></tr><tr><td>1</td><td>卖出</td></tr></tbody></table><table><thead><tr><th>ordertype</th><th>交易方向</th></tr></thead><tbody><tr><td>0</td><td>增强限价单(普通交易)</td></tr><tr><td>1</td><td>竞价单(竞价交易)</td></tr><tr><td>3</td><td>竞价限价单(竞价限价)</td></tr></tbody></table><table><thead><tr><th>envtype</th><th>交易环境参数</th></tr></thead><tbody><tr><td>0</td><td>真实交易</td></tr><tr><td>1</td><td>仿真交易</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>localid</strong>：订单的本地标识。用户自己管理，用来改单、设置订单状态等。</p><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li><li>不满足下单条件</li></ol><h3><a name='header-c111' class='md-header-anchor '></a>设置订单状态 set_order_status</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">set_order_status</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">status</span>, <span class="cm-variable">localid</span>=<span class="cm-number">0</span>, <span class="cm-variable">orderid</span>=<span class="cm-number">0</span>, <span class="cm-variable">envtype</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：更改某指定港股订单状态。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包。</p><p><strong>status</strong>: 更改状态的类型。如下表所示。</p><p><strong>localid</strong>: 订单的本地标识。</p><p><strong>orderid</strong>: 订单ID。</p><p><strong>envtype</strong>: 交易环境参数。如下表所示。</p><p><strong>注</strong>: orderid、localid只用设一个非0的有效值即可。</p><table><thead><tr><th>status</th><th>更改状态的类型</th></tr></thead><tbody><tr><td>0</td><td>撤单</td></tr><tr><td>1</td><td>失效</td></tr><tr><td>2</td><td>生效</td></tr><tr><td>3</td><td>删除</td></tr></tbody></table><table><thead><tr><th>envtype</th><th>交易环境参数</th></tr></thead><tbody><tr><td>0</td><td>真实交易</td></tr><tr><td>1</td><td>仿真交易</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li><li>订单不存在</li></ol><h3><a name='header-c173' class='md-header-anchor '></a>修改订单 change_order</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">change_order</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">price</span>, <span class="cm-variable">qty</span>, <span class="cm-variable">localid</span>=<span class="cm-number">0</span>, <span class="cm-variable">orderid</span>=<span class="cm-number">0</span>, <span class="cm-variable">envtype</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：修改某指定港股订单。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包</p><p><strong>price</strong>: 交易价格。</p><p><strong>qty</strong>: 交易数量。</p><p><strong>localid</strong>: 订单的本地标识。</p><p><strong>orderid</strong>: 订单ID。</p><p><strong>envtype</strong>: 交易环境参数。如下表所示。</p><p><strong>注</strong>: orderid、localid只用设一个非0的有效值即可。</p><table><thead><tr><th>envtype</th><th>交易环境参数</th></tr></thead><tbody><tr><td>0</td><td>真实交易</td></tr><tr><td>1</td><td>仿真交易</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li><li>订单不存在</li></ol><h3><a name='header-c221' class='md-header-anchor '></a>查询账户信息 accinfo_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">accinfo_query</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">envtype</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询港股账户信息。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包</p><p><strong>envtype</strong>: 交易环境参数。如下表所示。</p><table><thead><tr><th>envtype</th><th>交易环境参数</th></tr></thead><tbody><tr><td>0</td><td>真实交易</td></tr><tr><td>1</td><td>仿真交易</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><table><thead><tr><th>返回字符串</th><th>说明</th><th>返回字符串</th><th>说明</th></tr></thead><tbody><tr><td>Power</td><td>购买力</td><td>ZCJZ</td><td>资产净值</td></tr><tr><td>ZQSZ</td><td>证券市值</td><td>XJJY</td><td>现金结余</td></tr><tr><td>KQXJ</td><td>可取现金</td><td>DJZJ</td><td>冻结资金</td></tr><tr><td>ZSJE</td><td>追收金额</td><td>ZGJDE</td><td>最高借贷额</td></tr><tr><td>YYJDE</td><td>已用借贷额</td><td>GPBZJ</td><td>股票保证金</td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c287' class='md-header-anchor '></a>查询订单列表 order_list_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">order_list_query</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">envtype</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询港股今日订单列表。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>:本地cookie，用来区分回包</p><p><strong>envtype</strong>: 交易环境参数。如下表所示。</p><table><thead><tr><th>envtype</th><th>交易环境参数</th></tr></thead><tbody><tr><td>0</td><td>真实交易</td></tr><tr><td>1</td><td>仿真交易</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><table><thead><tr><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >stock_code</td><td style='text-align:left;' >股票ID哈希值</td><td style='text-align:left;' >stock_name</td><td style='text-align:left;' >股票名称</td></tr><tr><td style='text-align:left;' >dealt_avg_price</td><td style='text-align:left;' >成交均价</td><td style='text-align:left;' >dealt_qty</td><td style='text-align:left;' >成交数量</td></tr><tr><td style='text-align:left;' >localid</td><td style='text-align:left;' >订单本地标识</td><td style='text-align:left;' >orderid</td><td style='text-align:left;' >订单ID</td></tr><tr><td style='text-align:left;' >order_type</td><td style='text-align:left;' >交易类型</td><td style='text-align:left;' >price</td><td style='text-align:left;' >交易价格</td></tr><tr><td style='text-align:left;' >status</td><td style='text-align:left;' >订单状态(具体状态如下)</td><td style='text-align:left;' >submited_time</td><td style='text-align:left;' >提交时间</td></tr><tr><td style='text-align:left;' >updated_time</td><td style='text-align:left;' >更新时间</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><table><thead><tr><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th></tr></thead><tbody><tr><td style='text-align:left;' >0</td><td style='text-align:left;' >服务器处理中</td><td style='text-align:left;' >1</td><td style='text-align:left;' >等待成交</td></tr><tr><td style='text-align:left;' >2</td><td style='text-align:left;' >部分成交</td><td style='text-align:left;' >3</td><td style='text-align:left;' >全部成交</td></tr><tr><td style='text-align:left;' >4</td><td style='text-align:left;' >已失效</td><td style='text-align:left;' >5</td><td style='text-align:left;' >下单失败</td></tr><tr><td style='text-align:left;' >6</td><td style='text-align:left;' >已撤单</td><td style='text-align:left;' >7</td><td style='text-align:left;' >已删除</td></tr><tr><td style='text-align:left;' >8</td><td style='text-align:left;' >等待开盘</td><td style='text-align:left;' >21</td><td style='text-align:left;' >本地已发送</td></tr><tr><td style='text-align:left;' >22</td><td style='text-align:left;' >本地已发送，服务器返回下单失败、没产生订单</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr><tr><td style='text-align:left;' >23</td><td style='text-align:left;' >本地已发送，等待服务器返回超时</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c399' class='md-header-anchor '></a>查询持仓列表 position_list_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">position_list_query</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">envtype</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询港股持仓列表。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>:本地cookie，用来区分回包。</p><p><strong>envtype</strong>: 交易环境参数。如下表所示。</p><table><thead><tr><th style='text-align:left;' >envtype</th><th style='text-align:left;' >交易环境参数</th></tr></thead><tbody><tr><td style='text-align:left;' >0</td><td style='text-align:left;' >真实交易</td></tr><tr><td style='text-align:left;' >1</td><td style='text-align:left;' >仿真交易</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><table><thead><tr><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >stock_code</td><td style='text-align:left;' >股票ID哈希值</td><td style='text-align:left;' >stock_name</td><td style='text-align:left;' >股票名称</td></tr><tr><td style='text-align:left;' >qty</td><td style='text-align:left;' >持有数量</td><td style='text-align:left;' >can_sell_qty</td><td style='text-align:left;' >可卖数量</td></tr><tr><td style='text-align:left;' >cost_price</td><td style='text-align:left;' >成本价</td><td style='text-align:left;' >cost_price_valid</td><td style='text-align:left;' >成本价是否有效(非0有效)</td></tr><tr><td style='text-align:left;' >market_val</td><td style='text-align:left;' >市值</td><td style='text-align:left;' >nominal_price</td><td style='text-align:left;' >市价</td></tr><tr><td style='text-align:left;' >pl_ratio</td><td style='text-align:left;' >盈亏比例</td><td style='text-align:left;' >pl_ratio_valid</td><td style='text-align:left;' >盈亏比例是否有效(非0有效)</td></tr><tr><td style='text-align:left;' >pl_val</td><td style='text-align:left;' >盈亏金额</td><td style='text-align:left;' >pl_val_valid</td><td style='text-align:left;' >盈亏金额是否有效(非0有效)</td></tr><tr><td style='text-align:left;' >today_buy_qty</td><td style='text-align:left;' >今日买入数量</td><td style='text-align:left;' >today_buy_val</td><td style='text-align:left;' >今日买入金额</td></tr><tr><td style='text-align:left;' >today_pl_val</td><td style='text-align:left;' >今日盈亏金额</td><td style='text-align:left;' >today_sell_qty</td><td style='text-align:left;' >今日卖出数量</td></tr><tr><td style='text-align:left;' >today_sell_val</td><td style='text-align:left;' >今日卖出金额</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c485' class='md-header-anchor '></a>查询成交列表 deal_list_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradehk_ctx</span>.<span class="cm-property">deal_list_query</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">envtype</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询港股今日成交列表。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>:本地cookie，用来区分回包。</p><p><strong>envtype</strong>: 交易环境参数。如下表所示。</p><table><thead><tr><th>envtype</th><th>交易环境参数</th></tr></thead><tbody><tr><td>0</td><td>真实交易</td></tr><tr><td>1</td><td>仿真交易</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>price</strong>: 交易价格。</p><p><strong>qty</strong>: 交易数量。</p><p><strong>localid</strong>: 订单的本地标识。</p><p><strong>orderid</strong>: 订单ID。</p><p><strong>status</strong>: 订单状态。如下表所示。</p><table><thead><tr><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th></tr></thead><tbody><tr><td style='text-align:left;' >0</td><td style='text-align:left;' >服务器处理中</td><td style='text-align:left;' >1</td><td style='text-align:left;' >等待成交</td></tr><tr><td style='text-align:left;' >2</td><td style='text-align:left;' >部分成交</td><td style='text-align:left;' >3</td><td style='text-align:left;' >全部成交</td></tr><tr><td style='text-align:left;' >4</td><td style='text-align:left;' >已失效</td><td style='text-align:left;' >5</td><td style='text-align:left;' >下单失败</td></tr><tr><td style='text-align:left;' >6</td><td style='text-align:left;' >已撤单</td><td style='text-align:left;' >7</td><td style='text-align:left;' >已删除</td></tr><tr><td style='text-align:left;' >8</td><td style='text-align:left;' >等待开盘</td><td style='text-align:left;' >21</td><td style='text-align:left;' >本地已发送</td></tr><tr><td style='text-align:left;' >22</td><td style='text-align:left;' >本地已发送，服务器返回下单失败、没产生订单</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr><tr><td style='text-align:left;' >23</td><td style='text-align:left;' >本地已发送，等待服务器返回超时</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol><p></p><h1><a name='header-c572' class='md-header-anchor '></a>美股交易接口</h1><h3><a name='header-c573' class='md-header-anchor '></a>实例化上下文对象</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">tradeus_ctx</span> = <span class="cm-variable">OpenUSTradeContext</span>(<span class="cm-variable">host</span>=<span class="cm-string">'127.0.0.1'</span>, <span class="cm-variable">sync_port</span>=<span class="cm-number">11111</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：创建上下文，建立网络连接。
<strong>参数</strong>:
<strong>host</strong>：网络连接地址
<strong>sync_port</strong>：网络连接端口，用于同步通信。</p><p></p><h3><a name='header-c582' class='md-header-anchor '></a>解锁接口 unlock_trade</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">unlock_trade</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">password</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：交易解锁。</p><p><strong>参数</strong>：
<strong>cookie</strong>: 本地cookie，用来区分回包。
<strong>password</strong>: 用户交易密码。</p><p><strong>返回</strong>：
ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>失败情况</strong>：</p><ol><li>交易密码错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c604' class='md-header-anchor '></a>下单接口 place_order</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">place_order</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">price</span>, <span class="cm-variable">qty</span>, <span class="cm-variable">strcode</span>, <span class="cm-variable">orderside</span>, <span class="cm-variable">ordertype</span>=<span class="cm-number">2</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：美股下单接口。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包。</p><p><strong>price</strong>: 交易价格。</p><p><strong>qty</strong>: 交易数量</p><p><strong>strcode</strong>: 股票ID。<strong>不用带市场参数</strong>。例如：“AAPL”。</p><p><strong>orderside</strong>: 交易方向。如下表所示。</p><p><strong>ordertype</strong>: 交易类型。<strong>与港股不同！</strong>如下表所示。</p><table><thead><tr><th>orderside</th><th>交易方向</th></tr></thead><tbody><tr><td>0</td><td>买入</td></tr><tr><td>1</td><td>卖出</td></tr></tbody></table><table><thead><tr><th>ordertype</th><th>交易方向</th></tr></thead><tbody><tr><td>1</td><td>市价单</td></tr><tr><td>2</td><td>限价</td></tr><tr><td>51</td><td>盘前交易、限价</td></tr><tr><td>52</td><td>盘后交易、限价</td></tr></tbody></table><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>localid</strong>：订单的本地标识。用户自己管理，用来改单、设置订单状态等。</p><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li><li>不满足下单条件</li></ol><h3><a name='header-c668' class='md-header-anchor '></a>设置订单状态 set_order_status</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">set_order_status</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">localid</span>=<span class="cm-number">0</span>, <span class="cm-variable">orderid</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：更改某指定美股订单状态。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包。</p><p><strong>localid</strong>: 订单的本地标识。</p><p><strong>orderid</strong>: 订单ID。</p><p><strong>注</strong>: orderid、localid只用设一个非0的有效值即可。</p><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li><li>订单不存在</li></ol><p></p><h3><a name='header-c702' class='md-header-anchor '></a>修改订单 change_order</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">change_order</span>(<span class="cm-variable">cookie</span>, <span class="cm-variable">price</span>, <span class="cm-variable">qty</span>, <span class="cm-variable">localid</span>=<span class="cm-number">0</span>, <span class="cm-variable">orderid</span>=<span class="cm-number">0</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：修改某指定美股订单。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包。</p><p><strong>price</strong>: 交易价格。</p><p><strong>qty</strong>: 交易数量。</p><p><strong>localid</strong>: 订单的本地标识。</p><p><strong>orderid</strong>: 订单ID。</p><p><strong>注</strong>: orderid、localid只用设一个非0的有效值即可。</p><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li><li>订单不存在</li></ol><h3><a name='header-c738' class='md-header-anchor '></a>查询账户信息 accinfo_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">accinfo_query</span>(<span class="cm-variable">cookie</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询美股账户信息。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>: 本地cookie，用来区分回包</p><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><table><thead><tr><th>返回字符串</th><th>说明</th><th>返回字符串</th><th>说明</th></tr></thead><tbody><tr><td>Power</td><td>购买力</td><td>ZCJZ</td><td>资产净值</td></tr><tr><td>ZQSZ</td><td>证券市值</td><td>XJJY</td><td>现金结余</td></tr><tr><td>KQXJ</td><td>可取现金</td><td>DJZJ</td><td>冻结资金</td></tr><tr><td>ZSJE</td><td>追收金额</td><td>ZGJDE</td><td>最高借贷额</td></tr><tr><td>YYJDE</td><td>已用借贷额</td><td>GPBZJ</td><td>股票保证金</td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c792' class='md-header-anchor '></a>查询订单列表 order_list_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">order_list_query</span>(<span class="cm-variable">cookie</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询美股今日订单列表。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>:本地cookie，用来区分回包。</p><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><table><thead><tr><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >stock_code</td><td style='text-align:left;' >股票ID哈希值</td><td style='text-align:left;' >stock_name</td><td style='text-align:left;' >股票名称</td></tr><tr><td style='text-align:left;' >dealt_avg_price</td><td style='text-align:left;' >成交均价</td><td style='text-align:left;' >dealt_qty</td><td style='text-align:left;' >成交数量</td></tr><tr><td style='text-align:left;' >localid</td><td style='text-align:left;' >订单本地标识</td><td style='text-align:left;' >orderid</td><td style='text-align:left;' >订单ID</td></tr><tr><td style='text-align:left;' >order_type</td><td style='text-align:left;' >交易类型</td><td style='text-align:left;' >price</td><td style='text-align:left;' >交易价格</td></tr><tr><td style='text-align:left;' >status</td><td style='text-align:left;' >订单状态(具体状态如下)</td><td style='text-align:left;' >submited_time</td><td style='text-align:left;' >提交时间</td></tr><tr><td style='text-align:left;' >updated_time</td><td style='text-align:left;' >更新时间</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><table><thead><tr><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th></tr></thead><tbody><tr><td style='text-align:left;' >0</td><td style='text-align:left;' >服务器处理中</td><td style='text-align:left;' >1</td><td style='text-align:left;' >等待成交</td></tr><tr><td style='text-align:left;' >2</td><td style='text-align:left;' >部分成交</td><td style='text-align:left;' >3</td><td style='text-align:left;' >全部成交</td></tr><tr><td style='text-align:left;' >4</td><td style='text-align:left;' >已失效</td><td style='text-align:left;' >5</td><td style='text-align:left;' >下单失败</td></tr><tr><td style='text-align:left;' >6</td><td style='text-align:left;' >已撤单</td><td style='text-align:left;' >7</td><td style='text-align:left;' >已删除</td></tr><tr><td style='text-align:left;' >8</td><td style='text-align:left;' >等待开盘</td><td style='text-align:left;' >21</td><td style='text-align:left;' >本地已发送</td></tr><tr><td style='text-align:left;' >22</td><td style='text-align:left;' >本地已发送，服务器返回下单失败、没产生订单</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr><tr><td style='text-align:left;' >23</td><td style='text-align:left;' >本地已发送，等待服务器返回超时</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c892' class='md-header-anchor '></a>查询持仓列表 position_list_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">position_list_query</span>(<span class="cm-variable">cookie</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询美股持仓列表。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>:本地cookie，用来区分回包</p><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><table><thead><tr><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th><th style='text-align:left;' >返回字符串</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >stock_code</td><td style='text-align:left;' >股票ID哈希值</td><td style='text-align:left;' >stock_name</td><td style='text-align:left;' >股票名称</td></tr><tr><td style='text-align:left;' >qty</td><td style='text-align:left;' >持有数量</td><td style='text-align:left;' >can_sell_qty</td><td style='text-align:left;' >可卖数量</td></tr><tr><td style='text-align:left;' >cost_price</td><td style='text-align:left;' >成本价</td><td style='text-align:left;' >cost_price_valid</td><td style='text-align:left;' >成本价是否有效(非0有效)</td></tr><tr><td style='text-align:left;' >market_val</td><td style='text-align:left;' >市值</td><td style='text-align:left;' >nominal_price</td><td style='text-align:left;' >市价</td></tr><tr><td style='text-align:left;' >pl_ratio</td><td style='text-align:left;' >盈亏比例</td><td style='text-align:left;' >pl_ratio_valid</td><td style='text-align:left;' >盈亏比例是否有效(非0有效)</td></tr><tr><td style='text-align:left;' >pl_val</td><td style='text-align:left;' >盈亏金额</td><td style='text-align:left;' >pl_val_valid</td><td style='text-align:left;' >盈亏金额是否有效(非0有效)</td></tr><tr><td style='text-align:left;' >today_buy_qty</td><td style='text-align:left;' >今日买入数量</td><td style='text-align:left;' >today_buy_val</td><td style='text-align:left;' >今日买入金额</td></tr><tr><td style='text-align:left;' >today_pl_val</td><td style='text-align:left;' >今日盈亏金额</td><td style='text-align:left;' >today_sell_qty</td><td style='text-align:left;' >今日卖出数量</td></tr><tr><td style='text-align:left;' >today_sell_val</td><td style='text-align:left;' >今日卖出金额</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol><h3><a name='header-c966' class='md-header-anchor '></a>查询成交列表 deal_list_query</h3><pre class="md-fences"><div class="code-tooltip md-tooltip-hide" align="right"></div> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div class="CodeMirror-hscrollbar" style="left: 0px;"></div><div class="CodeMirror-vscrollbar"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; min-height: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-code"><pre class=""><span style="padding-right: 0.1px;"><span class="cm-variable">ret_code</span>, <span class="cm-variable">ret_data</span> = <span class="cm-variable">tradeus_ctx</span>.<span class="cm-property">deal_list_query</span>(<span class="cm-variable">cookie</span>)</span></pre></div></div></div></div></div></div></div></pre><p><strong>功能</strong>：查询美股今日成交列表。</p><p><strong>参数</strong>：</p><p><strong>cookie</strong>:本地cookie，用来区分回包。</p><p><strong>返回:</strong></p><p>ret_code失败时，ret_data返回为错误描述字符串；
正常情况下，ret_data为SvrResult为1，错误情况下，SvrResult为-1。</p><p><strong>price</strong>: 交易价格。</p><p><strong>qty</strong>: 交易数量。</p><p><strong>localid</strong>: 订单的本地标识。</p><p><strong>orderid</strong>: 订单ID。</p><p><strong>status</strong>: 订单状态。如下表所示。</p><table><thead><tr><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th><th style='text-align:left;' >status</th><th style='text-align:left;' >订单类型</th></tr></thead><tbody><tr><td style='text-align:left;' >0</td><td style='text-align:left;' >服务器处理中</td><td style='text-align:left;' >1</td><td style='text-align:left;' >等待成交</td></tr><tr><td style='text-align:left;' >2</td><td style='text-align:left;' >部分成交</td><td style='text-align:left;' >3</td><td style='text-align:left;' >全部成交</td></tr><tr><td style='text-align:left;' >4</td><td style='text-align:left;' >已失效</td><td style='text-align:left;' >5</td><td style='text-align:left;' >下单失败</td></tr><tr><td style='text-align:left;' >6</td><td style='text-align:left;' >已撤单</td><td style='text-align:left;' >7</td><td style='text-align:left;' >已删除</td></tr><tr><td style='text-align:left;' >8</td><td style='text-align:left;' >等待开盘</td><td style='text-align:left;' >21</td><td style='text-align:left;' >本地已发送</td></tr><tr><td style='text-align:left;' >22</td><td style='text-align:left;' >本地已发送，服务器返回下单失败、没产生订单</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr><tr><td style='text-align:left;' >23</td><td style='text-align:left;' >本地已发送，等待服务器返回超时</td><td style='text-align:left;' ></td><td style='text-align:left;' ></td></tr></tbody></table><p><strong>失败情况</strong>：</p><ol><li>参数错误</li><li>客户端内部或网络错误</li></ol></div>
</body>
</html>